package cn.tedu.boot1001.controller;

import cn.tedu.boot1001.entity.Student;
import cn.tedu.boot1001.mapper.StudentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/student/")
public class StudentController {

    @Autowired
    StudentMapper mapper;

    @RequestMapping("insert")
    public void insert(@RequestBody Student student){
        mapper.insert(student);
    }

    @RequestMapping("deleteById")
    public void deleteById(int id){
        mapper.deleteById(id);
    }

    @RequestMapping("selectByCid")
    public List<Student> selectByCid(int id){
        return mapper.selectByCid(id);
    }
}
